www.gusucode.com > Matlab在化学工程中的应用 > Matlab在化学工程中的应用/实用化工计算机模拟-Matlab在化学工程中的应用/Examples/Chapter 5/PDEtoolPoisson.m
function pdemodel % % Author: HUANG Huajiang % Copyright 2003 UNILAB Research Center, % East China University of Science and Technology, Shanghai, PRC % $Revision: 1.0 $ $Date: 2003/03/12 $ [pde_fig,ax]=pdeinit; pdetool('appl_cb',1); set(ax,'DataAspectRatio',[1 1.5 1]); set(ax,'PlotBoxAspectRatio',[6 4 1]); set(ax,'XLim',[-6 6]); set(ax,'YLim',[-6 6]); set(ax,'XTickMode','auto'); set(ax,'YTickMode','auto'); pdetool('gridon','on'); % Geometry description: pderect([-5 5 5 -5],'R1'); set(findobj(get(pde_fig,'Children'),'Tag','PDEEval'),'String','R1') % Boundary conditions: pdetool('changemode',0) pdesetbd(4,... 'dir',... 1,... '1',... '100') pdesetbd(3,... 'dir',... 1,... '1',... '100') pdesetbd(2,... 'dir',... 1,... '1',... '100') pdesetbd(1,... 'dir',... 1,... '1',... '100') % Mesh generation: setuprop(pde_fig,'Hgrad',1.3); setuprop(pde_fig,'refinemethod','regular'); pdetool('initmesh') pdetool('refine') pdetool('jiggle') % PDE coefficients: pdeseteq(1,... '1.0',... '0.0',... '2',... '1.0',... '0:10',... '0.0',... '0.0',... '[0 100]') setuprop(pde_fig,'currparam',... ['1.0';... '0.0';... '2 ';... '1.0']) % Solve parameters: setuprop(pde_fig,'solveparam',... str2mat('0','1992','10','pdeadworst',... '0.5','longest','0','1E-4','','fixed','Inf')) % Plotflags and user data strings: setuprop(pde_fig,'plotflags',[1 1 1 1 1 1 1 1 0 0 0 1 1 0 1 0 0 1]); setuprop(pde_fig,'colstring',''); setuprop(pde_fig,'arrowstring',''); setuprop(pde_fig,'deformstring',''); setuprop(pde_fig,'heightstring',''); % Solve PDE: pdetool('solve')